<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="Dashboard">
    <meta name="keyword" content="Dashboard, Bootstrap, Admin, Template, Theme, Responsive, Fluid, Retina">

    <title>DASHGUM - Bootstrap Admin Template</title>


    {% load static %}
    <link rel="stylesheet" href="{% static 'assets/css/style-qr.css' %}">
    <link rel="stylesheet" href="{% static 'assets/css/notice.min.css' %}">
    <link rel="stylesheet"
          href="{% static 'assets/css/default.min.css' %}">

    <!-- Bootstrap core CSS -->
    <link href="{% static 'assets/css/bootstrap.css' %}" rel="stylesheet">
    <!--external css-->
    <link href="{% static 'assets/font-awesome/css/font-awesome.css' %}" rel="stylesheet" />
    <link rel="stylesheet" type="text/css" href="{% static 'assets/js/bootstrap-datepicker/css/datepicker.css' %}" />
    <link rel="stylesheet" type="text/css" href="{% static 'assets/js/bootstrap-daterangepicker/daterangepicker.css' %}" />

    <!-- Custom styles for this template -->
    <link href="{% static 'assets/css/style.css' %}" rel="stylesheet">
    <link href="{% static 'assets/css/style-responsive.css' %}" rel="stylesheet">

    <link href="{% static 'assets/css/purchase.css' %}" rel="stylesheet">
    <link href="{% static 'assets/css/the-datepicker.css' %}" rel="stylesheet">
    <link rel="stylesheet" href="{% static 'assets/fonts/icon/iconfont.css' %}">


  </head>

  <body>

  <section id="container" >
      <!-- **********************************************************************************************************************************************************
      TOP BAR CONTENT & NOTIFICATIONS
      *********************************************************************************************************************************************************** -->
      <!--header start-->
      <header class="header black-bg">
        <div class="sidebar-toggle-box">
            <div class="fa fa-bars tooltips" data-placement="right" data-original-title="Toggle Navigation"></div>
        </div>
      <!--logo start-->
      <a href="index.html" class="logo"><b>MD集团物料管理系统</b></a>
      <!--logo end-->
      <div class="nav notify-row" id="top_menu">
          <!--  notification start -->
      
  </header>
<!--header end-->

<!-- **********************************************************************************************************************************************************
MAIN SIDEBAR MENU
*********************************************************************************************************************************************************** -->
<!--sidebar start-->
<aside>
    <div id="sidebar"  class="nav-collapse ">
        <!-- sidebar menu start-->
        <ul class="sidebar-menu" id="nav-accordion">
        
              <p class="centered"><img src="{% static 'assets/img/ui-sam.jpg' %}" class="img-circle" width="60"></a></p>
              <h5 class="centered">物料管理</h5>
                  
            <li class="mt">
                <a href="{% url 'MM:login' %}">
                    <i class="fa fa-dashboard"></i>
                    <span>主页</span>
                </a>
            </li>

            <li class="sub-menu">
                <a href="javascript:;" >
                    <i class="fa fa-desktop"></i>
                    <span>供应商管理</span>
                </a>
                <ul class="sub">
                    <li><a  href="general.html">创建新供应商</a></li>
                    <li><a  href="buttons.html">查看或修改供应商信息</a></li>
                    {% comment %} <li><a  href="panels.html">Panels</a></li> {% endcomment %}
                </ul>
            </li>

            <li class="sub-menu">
                <a href="javascript:;" >
                    <i class="fa fa-cogs"></i>
                    <span>商品管理</span>
                </a>
                <ul class="sub">
                    <li><a  href="calendar.html">创建新商品</a></li>
                    <li><a  href="gallery.html">查看或修改商品信息</a></li>
                    <li><a  href="todo_list.html">查看商品库存</a></li>
                </ul>
            </li>
            {% comment %} <li class="sub-menu">
                <a href="javascript:;" >
                    <i class="fa fa-book"></i>
                    <span>采购订单管理</span>
                </a>
                <ul class="sub">
                    <li><a  href="blank.html">Blank Page</a></li>
                    <li><a  href="login.html">Login</a></li>
                    <li><a  href="lock_screen.html">Lock Screen</a></li>
                </ul>
            </li> {% endcomment %}
            <li class="sub-menu">
                <a class="active" href="javascript:;" >
                    <i class="fa fa-tasks"></i>
                    <span>收货管理</span>
                </a>
                <ul class="sub">
                    <li class="active"><a  href="form_component.html">创建商品收据</a></li>
                    <li class="active"><a  href="form_component.html">查看商品收据</a></li>
                    <li class="active"><a  href="form_component.html">创建发票收据</a></li>
                    <li class="active"><a  href="form_component.html">查看发票收据</a></li>
                    <li class="active"><a  href="form_component.html">付款</a></li>
                </ul>
            </li>
            <li class="sub-menu">
                <a href="javascript:;" >
                    <i class="fa fa-th"></i>
                    <span>采购订单管理</span>
                </a>
                <ul class="sub">
                    <li><a  href="/mm/purchaserequisition/getpq/">采购申请</a></li>
                    <li><a  href="/mm/quotation/vreview/">供应商评估管理</a></li>
                    <li><a  href="/mm/purchaseorder/searchpo/">采购订单</a></li>
                </ul>
            </li>
            

        </ul>
        <!-- sidebar menu end-->
    </div>
</aside>
      
      <!-- **********************************************************************************************************************************************************
      MAIN CONTENT
      *********************************************************************************************************************************************************** -->
      <!--main content start-->
      <section id="main-content">
          <section class="wrapper">
          	<h3><i class="fa fa-angle-right"></i> 添加供应商报价</h3>
		  		<div class="row mt">
                    <div class="col-lg-12">
			  		<div class="col-lg-12">
                      <div class="content-panel">
                      <h4><i class="fa fa-angle-right"></i> 报价申请详情</h4>
                          <section id="unseen">

                            <table class="table">
                                <thead>
                                    <tr>
                                        <th>报价申请信息</th>
                                       
                                    </tr>
                                    </thead>
                                    <tbody>
                                        {% for c in quotation %}
                                        <tr>
                                            <td>
                                                <label>报价申请单编码：</label>
                                                <label>{{ c.id }}</label>
                                            </td>
                                            <td>
                                                <label>创建者编码：</label>
                                                <label>{{ c.euser_id }}</label>
                                            </td>
                                        </tr>
                                        <tr>
                                          
                                            <td>
                                                <label>询价单的截止日期：</label>
                                                <label id="duedate">{{ c.deadline }}</label>
                                            </td>
                                            
                                            <td>
                                                <label>创建时间：</label>
                                                <label>{{ c.time }}</label>
                                            </td>
                                        </tr>
                                        {% endfor %}
                        
                                </thead>
                    
                            </table>



                              
                              <table class="table">
                                <thead>
                                <tr>

                                    <th>商品信息</th>
                                    
                                </tr>
                                </thead>
                                <tbody>
                                    {% for c in materialitem %}
                                    <tr>
                                        <td>
                                            <label>采购组织：</label>
                                            <label>{{c.meterial__stock__pOrg}}</label>
                                        </td>
                                        
                                        <td>
                                            <label>采购组：</label>
                                            <label>{{c.meterial__stock__pGrp}}</label>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <label>商品编码：</label>
                                            <label>{{c.meterial__id}}</label>
                                        </td>
                                        <td>
                                            <label>数量：</label>
                                            <label>{{ c.quantity }}</label>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <label>送货时间：</label>
                                            <label>{{ c.deliveryDate }}</label>
                                        </td>
                                        <td>
                                            <label>工厂：</label>
                                            <label>{{c.meterial__stock__name}}</label>
                                        </td>
                                        <td>
                                            <label>存储位置：</label>
                                            <label>{{c.meterial__sloc}}</label>
                                        </td>
                                       
                                    </tr>
                                    {% endfor %}
                                </tbody>
                            </table>
                        
                            <table class="table">
                                <thead>
                                <tr>
                                    {% for c in vendor %}

                                    <th style="display: flex;justify-content: space-between;">
                                        供应商相关信息
                                        <div style="margin-left: 2%;">
                                          <label><span class="iconfont">&#xf0290;</span>&nbsp;供应商评分：</label>
                                          <label>{{ c.score }}</label>
                                        </div>
                                </th>
                                    
                                </tr>
                                </thead>
                                <tbody>
                                    <tr>
                                        <td>
                                            <label>供应商编码：</label>
                                            <label>{{ c.vid }}</label>
                                        </td>
                                        <td>
                                            <label>供应商名称：</label>
                                            <label>{{ c.vname }}</label>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <label>城市：</label>
                                            <label>{{ c.city }}</label>
                                        </td>
                                        <td>
                                            <label>街区地址：</label>
                                            <label>{{ c.address }}</label>
                                        </td>
                                        <td>
                                            <label>供应商邮编：</label>
                                            <label>{{ c.postcode }}</label>
                                        </td>
                                    </tr>

                                    {% endfor %}
                                </tbody>
                            </table>


                           
	<!-- INLINE FORM ELELEMNTS -->
    <div class="row mt">
        <div class="col-lg-12">
            <div class="form-panel">
              <h4 class="mb"><i class="fa fa-angle-right"></i> 报价</h4>
            <form class="form-inline"  method="post">
                <table class="table">
                <thead>
                <tr>
                </tr>
                </thead>
                <tbody>
                    <tr>
                        <td style="display:flex">
                            <label>报价：</label>
                            <div class="form-group" style="display:flex">
                                <input  class="form-control" name="price" placeholder="报价数值"><input  class="form-control" placeholder="单位" onclick="currencyf()" name="currency" id="danwei" style="width:100px">
                            </div>
                        </td>
                        <td>
                            <label>报价有效期：</label>
                            <div class="form-group">
                                <input  class="form-control"   name="validTime" placeholder="Valid to"  onclick="date(this)">
                            </div>
                            
                        </td>
                       
                    </tr>
                </tbody>
            </table>
            <div id="btn-vq-create">
                <button type="submit" class="btn btn-primary btn-lg btn-block" >添加供应商报价</button>
        </div>
            </form>
                                                {{insertmessage}}
            </div><!-- /form-panel -->
        </div><!-- /col-lg-12 -->
    </div><!-- /row -->

                      

 <!--结算货币modal-->
 <div class="col-sm-12">
    <div class="modal fade" id="myModalcurr" tabindex="-1" role="dialog" aria-labelledby="myModalLabel1" aria-hidden="true">
        <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
            <h4 class="modal-title" id="myModalLabel">货币</h4>
            </div>
            <div class="modal-body">
            *双击填入货币
            <table  class="table table-bordered table-striped table-condensed">
                <thead>
                    <!-- tr 指定表行标签-->
                    <tr>
                        <!-- th 设置表头内容，默认加粗-->
                        <th style="width: 100px;">序号</th>
                        <th style="width: 120px;">货币</th>
                        <th>名称</th>
                    </tr>
                </thead>
                <tbody id="currDiv">

                </tbody>
            </table>

                </div>
                <div class="modal-footer">
                </div>
            </div>
            </div>
        </div>
        </div>
    <!--结算货币modal-->

                            
                          </section>
                    </div><!-- /content-panel -->
                </div><!-- /col-lg-4 -->			
		  	</div><!-- /r ow -->


		</section><! --/wrapper -->
      </section><!-- /MAIN CONTENT -->

      <!--main content end-->
      <!--footer start-->
      <footer class="site-footer">
          <div class="text-center">
              2014 - Alvarez.is
              <a href="responsive_table.html#" class="go-top">
                  <i class="fa fa-angle-up"></i>
              </a>
          </div>
      </footer>
      <!--footer end-->
  </section>

    <!-- js placed at the end of the document so the pages load faster -->
    <script src="{% static 'assets/js/jquery.js' %}"></script>
    <script src="{% static 'assets/js/bootstrap.min.js' %}"></script>
    <script class="include" type="text/javascript" src="{% static 'assets/js/jquery.dcjqaccordion.2.7.js' %}"></script>
    <script src="{% static 'assets/js/jquery.scrollTo.min.js' %}"></script>
    <script src="{% static 'assets/js/jquery.nicescroll.js' %}" type="text/javascript"></script>
    <!--common script for all pages-->
    <script src="{% static 'assets/js/common-scripts.js' %}"></script>

    <!--script for this page-->
    <script src="{% static 'assets/js/jquery-ui-1.9.2.custom.min.js' %}"></script>

	<!--custom switch-->
	<script src="{% static 'assets/js/bootstrap-switch.js' %}"></script>
	
	<!--custom tagsinput-->
	<script src="{% static 'assets/js/jquery.tagsinput.js' %}"></script>
	
	<!--custom checkbox & radio-->

	<script src="{% static 'assets/js/form-component.js' %}"></script> 

    <script src="{% static 'assets/js/notice.min.js' %}"></script>
    <script>
        const notice = new Notice();
    </script>

    <script src="{% static 'assets/js/main-qr.js' %}"></script>
   
        <script src="{% static 'assets/js/the-datepicker.js' %}"></script>
   
    <script>
        function date(time){
            var datepicker = new TheDatepicker.Datepicker(time);
            datepicker.render();
            }
    </script>
    <script>

        $(document).ready(function() {
            
            $.ajax(
            {
                type: "post",
                url: "{% url 'MM:ajax_load_currency' %}",
                data:{
                    csrfmiddlewaretoken: '{{ csrf_token }}',
                },
                success: function(data) {
                    var dataObj = eval("("+data+")");
                    var out = "";
                    var i;
                    for(i = 0; i < dataObj.length; i++) {
                        out += '<tr><td>'+ i + '</td><td>' +dataObj[i].Currency + '</td><td>' + dataObj[i].Name +'</td><tr>';
                            //out += '<option value=' + +'>'+ dataObj[i].Currency + '--' + dataObj[i].Name + '</option>' ;
                    }
                    document.getElementById("currDiv").innerHTML=out;
                    
                },
                failure: function() {

                }
            })
        });
        $("table").on("dblclick","tr",function(e){
            
            document.getElementById("danwei").value=$(this).find('td').eq(1).text();
            $('#myModalcurr').modal('hide')
            
        });
        function currencyf() {
            console.log(1);

            //弹出模态框
            
            $("#myModalcurr").modal("show")
        }
      

    </script>
<script>
function create(){
    var duedate=document.getElementById("duedate").innerHTML
    var validto=document.getElementById("validto").value
    let due = duedate.match(/\d+/g);
    let valid = validto.match(/\d+/g)
    var dday=due[0]
    var dmonth=due[1]
    var dyear=due[2]
    var vday=valid[0]
    var vmonth=valid[1]
    var vyear=valid[2]

    var date = new Date(); 
    var year = date.getFullYear(); 
    var month = date.getMonth() + 1;
    var day = date.getDay();
   
    if($.trim(year) > parseInt(dyear) || (parseInt(year) == parseInt(dyear) && parseInt(month) > parseInt(dmonth)) ||( parseInt(year) == parseInt(dyear) && parseInt(month) == parseInt(dmonth) && parseInt(day) > parseInt(dday)))
    showMessage({text: '截止日期已过，无法添加报价!',type: 'warning'})
    else if(parseInt(vyear) < parseInt(dyear) || (parseInt(vyear) == parseInt(dyear) && parseInt(vmonth) < parseInt(dmonth)) ||( parseInt(vyear) == parseInt(dyear) && parseInt(vmonth) == parseInt(dmonth) && parseInt(vday) < parseInt(dday)))
    showMessage({text: '报价有效期必须在截止日期之后!',type: 'warning'})
    else    showMessage({text: '添加成功！',type: 'success'})  //成功
}
</script>
  </body>
</html>
